@extends('Index/vip/vip_base')
@section('con-right')
	<div class="pull-right">
		<div class="user-content__box clearfix bgf">
			<div class="title">订单中心-我的订单</div>
			<div class="order-list__box bgf">
				<div class="order-panel">
					<ul class="nav user-nav__title" role="tablist">
						<li role="presentation" class="nav-item active"><a href="/index/#all" aria-controls="all" role="tab" data-toggle="tab">所有订单</a></li>
						<li role="presentation" class="nav-item "><a href="/index/#pay" aria-controls="pay" role="tab" data-toggle="tab">待付款 <span class="cr">0</span></a></li>
						<li role="presentation" class="nav-item "><a href="/index/#emit" aria-controls="emit" role="tab" data-toggle="tab">待发货 <span class="cr">0</span></a></li>
						<li role="presentation" class="nav-item "><a href="/index/#take" aria-controls="take" role="tab" data-toggle="tab">待收货 <span class="cr">0</span></a></li>
						<li role="presentation" class="nav-item "><a href="/index/#eval" aria-controls="eval" role="tab" data-toggle="tab">待评价 <span class="cr">0</span></a></li>
					</ul>
					<script>
						$(function(){
							$('.user-nav__title li').each(function(i){
								$(this).find('span').html($('.tab-content .tab-pane').eq(i).find('.order-item').has('.num').length);
							})
						})
					</script>
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane fade in active" id="all">
							<table class="table text-center">
								<tr>
									<th width="380">商品信息</th>
									<th width="85">单价</th>
									<th width="85">数量</th>
									<th width="120">实付款</th>
									<th width="120">交易状态</th>
									<th width="120">交易操作</th>
								</tr>
								@foreach($orders as $order)
								@foreach($goods[$loop->index] as $glist)
								<tr class="order-item">
									<td>
										<label>
											@if($loop->first)
											<a href="/index/order/udai_order_detail?id={{$order->id}}" class="num">
												{{$order->date}} 订单号: {{$order->o_id}}
											</a>
											@endif
											<div class="card">
												<div class="img"><img src="/upload/{{$glist->img}}" alt="" class="cover"></div>
												<div class="name ep2">{{$glist->name}}</div>
												<div class="format">颜色分类：{{$glist->color}}  尺码：{{$glist->size}}</div>
												<div class="favour">使用优惠券：无</div>
											</div>
										</label>
									</td>
									<td>￥{{$glist->price}}</td>
									<td>{{$glist->num}}</td>
									@if($loop->first)
									<td>￥{{$order->cost}}<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
									@else
									<td></td>
									@endif
									<td class="state">
										@if($glist->state==0)
											@if($loop->first)
											<a class="but c6">等待付款</a>
											@else
											<a href=""></a>
											@endif
										@elseif($glist->state==1)
											<a class="but c6">等待发货</a>
										@elseif($glist->state==2)
											@if($loop->first)
											<a class="but c6">等待收货</a>
											@endif
										@elseif($glist->state==3)
											@if($loop->first)
											<a class="but c6">交易成功</a>
											@endif
										@elseif($glist->state==4)
											@if($loop->first)
											<a class="but c6">订单关闭</a>
											@endif
										@elseif($glist->state==5)
											@if($loop->first)
											<a class="but c6">订单已取消</a>
											@endif
										@endif
										@if($loop->first)
										<a href="/index/order/udai_order_detail?id={{$order->id}}" class="but c9">订单详情</a>
										@endif
									</td>
									<td class="order">
										@if($loop->first && $glist->state>3)
										<div class="del"><a href="/index/order/order_del?id={{$order->id}}" class="glyphicon glyphicon-trash delete" aria-hidden="true" style="color:#777; text-decoration:none;"></a></div>
										@endif
										@if($glist->state==0)
											@if($loop->first)
											<a href="/index/order/order_pay?id={{$order->id}}" class="but but-primary">立即付款</a>
											<a href="/index/order/order_cancel?id={{$order->id}}" class="but c3">取消订单</a>
											@endif
										@elseif($glist->state==1)
											@if($loop->first)
											<a href="/index/order/order_cancel?id={{$order->id}}" class="but c3">取消订单</a>
											@endif
										@elseif($glist->state==2)
											@if($loop->first)
											<a href="/index/order/udai_order_receipted?id={{$order->id}}" class="but but-primary">确认收货</a>
											@endif
										@elseif($glist->state==3)
										<a href="/index/order/udai_order_evaluate?id={{$glist->ogid}}" class="but but-link">评价</a>
										@endif
										<!-- <a href="/index/" class="but but-link">评价</a> -->
									</td>
								</tr>
								@endforeach
								@endforeach
								<tr class="order-empty">
									<td colspan='6'>
										<div class="empty-msg">最近没有任何订单，家里好像缺了点什么！<br><a href="/index/item_category.html">要不瞧瞧去？</a></div>
									</td>
								</tr>
							</table>
							<!-- 分页 -->
							{{$orders}}
						</div>
						<div role="tabpanel" class="tab-pane fade" id="pay">
							<table class="table text-center">
								<tr>
									<th width="380">商品信息</th>
									<th width="85">单价</th>
									<th width="85">数量</th>
									<th width="120">实付款</th>
									<th width="120">交易状态</th>
									<th width="120">交易操作</th>
								</tr>
								@foreach($orders as $order)
								@foreach($goods[$loop->index] as $glist)
								@if($glist->state==0)
								<tr class="order-item">
									<td>
										<label>
											@if($loop->first)
											<a href="/index/order/udai_order_detail?id={{$order->id}}" class="num">
												{{$order->date}} 订单号: {{$order->o_id}}
											</a>
											@endif
											<div class="card">
												<div class="img"><img src="/upload/{{$glist->img}}" alt="" class="cover"></div>
												<div class="name ep2">{{$glist->name}}</div>
												<div class="format">颜色分类：{{$glist->color}}  尺码：{{$glist->size}}</div>
												<div class="favour">使用优惠券：无</div>
											</div>
										</label>
									</td>
									<td>￥{{$glist->price}}</td>
									<td>{{$glist->num}}</td>
									@if($loop->first)
									<td>￥{{$order->cost}}<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
									@else
									<td></td>
									@endif
									<td class="state">
										@if($loop->first)
										<a class="but c6">等待付款</a>
										<a href="/index/order/udai_order_detail?id={{$order->id}}" class="but c9">订单详情</a>
										@endif
									</td>
									<td class="order">
										@if($loop->first)
										<a href="/index/order/order_pay?id={{$order->id}}" class="but but-primary">立即付款</a>
										<a href="/index/" class="but c3">取消订单</a>
										@endif
									</td>
								</tr>
								@endif
								@endforeach
								@endforeach
								<tr class="order-empty">
									<td colspan='6'>
										<div class="empty-msg">最近没有任何订单，家里好像缺了点什么！<br><a href="/index/item_category.html">要不瞧瞧去？</a></div>
									</td>
								</tr>
							</table>
							<!-- 分页 -->
						</div>
						<div role="tabpanel" class="tab-pane fade" id="emit">
							<table class="table text-center">
								<tr>
									<th width="380">商品信息</th>
									<th width="85">单价</th>
									<th width="85">数量</th>
									<th width="120">实付款</th>
									<th width="120">交易状态</th>
									<th width="120">交易操作</th>
								</tr>
								@foreach($orders as $order)
								@foreach($goods[$loop->index] as $glist)
								@if($glist->state==1)
								<tr class="order-item">
									<td>
										<label>
											@if($loop->first)
											<a href="/index/order/udai_order_detail?id={{$order->id}}" class="num">
												{{$order->date}} 订单号: {{$order->o_id}}
											</a>
											@endif
											<div class="card">
												<div class="img"><img src="/upload/{{$glist->img}}" alt="" class="cover"></div>
												<div class="name ep2">{{$glist->name}}</div>
												<div class="format">颜色分类：{{$glist->color}}  尺码：{{$glist->size}}</div>
												<div class="favour">使用优惠券：无</div>
											</div>
										</label>
									</td>
									<td>￥{{$glist->price}}</td>
									<td>{{$glist->num}}</td>
									@if($loop->first)
									<td>￥{{$order->cost}}<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
									@else
									<td></td>
									@endif
									<td class="state">
										<a class="but c6">等待发货</a>
										@if($loop->first)
										<a href="/index/order/udai_order_detail?id={{$order->id}}" class="but c9">订单详情</a>
										@endif
									</td>
									<td class="order">
										@if($loop->first)
										<a href="/index/" class="but c3">取消订单</a>
										@endif
									</td>
								</tr>
								@endif
								@endforeach
								@endforeach
								<tr class="order-empty">
									<td colspan='6'>
										<div class="empty-msg">最近没有任何订单，家里好像缺了点什么！<br><a href="/index/item_category.html">要不瞧瞧去？</a></div>
									</td>
								</tr>
							</table>
							<!-- 分页 -->
						</div>
						<div role="tabpanel" class="tab-pane fade" id="take">
							<table class="table text-center">
								<tr>
									<th width="380">商品信息</th>
									<th width="85">单价</th>
									<th width="85">数量</th>
									<th width="120">实付款</th>
									<th width="120">交易状态</th>
									<th width="120">交易操作</th>
								</tr>
								@foreach($orders as $order)
								@foreach($goods[$loop->index] as $glist)
								@if($glist->state==2)
								<tr class="order-item">
									<td>
										<label>
											@if($loop->first)
											<a href="/index/order/udai_order_detail?id={{$order->id}}" class="num">
												{{$order->date}} 订单号: {{$order->o_id}}
											</a>
											@endif
											<div class="card">
												<div class="img"><img src="/upload/{{$glist->img}}" alt="" class="cover"></div>
												<div class="name ep2">{{$glist->name}}</div>
												<div class="format">颜色分类：{{$glist->color}}  尺码：{{$glist->size}}</div>
												<div class="favour">使用优惠券：无</div>
											</div>
										</label>
									</td>
									<td>￥{{$glist->price}}</td>
									<td>{{$glist->num}}</td>
									@if($loop->first)
									<td>￥{{$order->cost}}<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
									@else
									<td></td>
									@endif
									<td class="state">
										@if($loop->first)
										<a class="but c6">等待收货</a>
										<a href="/index/order/udai_order_detail?id={{$order->id}}" class="but c9">订单详情</a>
										@endif
									</td>
									<td class="order">
										@if($loop->first)
										<a href="/index/order/udai_order_receipted?id={{$order->id}}" class="but but-primary">确认收货</a>
										@endif
									</td>
								</tr>
								@endif
								@endforeach
								@endforeach
								<tr class="order-empty">
									<td colspan='6'>
										<div class="empty-msg">最近没有任何订单，家里好像缺了点什么！<br><a href="/index/item_category.html">要不瞧瞧去？</a></div>
									</td>
								</tr>
							</table>
							<!-- 分页 -->
						</div>
						<div role="tabpanel" class="tab-pane fade" id="eval">
							<table class="table text-center">
								<tr>
									<th width="380">商品信息</th>
									<th width="85">单价</th>
									<th width="85">数量</th>
									<th width="120">实付款</th>
									<th width="120">交易状态</th>
									<th width="120">交易操作</th>
								</tr>
								@foreach($orders as $order)
								@foreach($goods[$loop->index] as $glist)
								@if($glist->state==3)
								<tr class="order-item">
									<td>
										<label>
											@if($loop->first)
											<a href="/index/order/udai_order_detail?id={{$order->id}}" class="num">
												{{$order->date}} 订单号: {{$order->o_id}}
											</a>
											@endif
											<div class="card">
												<div class="img"><img src="/upload/{{$glist->img}}" alt="" class="cover"></div>
												<div class="name ep2">{{$glist->name}}</div>
												<div class="format">颜色分类：{{$glist->color}}  尺码：{{$glist->size}}</div>
												<div class="favour">使用优惠券：无</div>
											</div>
										</label>
									</td>
									<td>￥{{$glist->price}}</td>
									<td>{{$glist->num}}</td>
									@if($loop->first)
									<td>￥{{$order->cost}}<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
									@else
									<td></td>
									@endif
									<td class="state">
										@if($loop->first)
										<a class="but c6">交易成功</a>
										<a href="/index/order/udai_order_detail?id={{$order->id}}" class="but c9">订单详情</a>
										@endif
									</td>
									<td class="order">
										<a href="/index/order/udai_order_evaluate?id={{$glist->ogid}}" class="but but-link">评价</a>
									</td>
								</tr>
								@endif
								@endforeach
								@endforeach
								<tr class="order-empty">
									<td colspan='6'>
										<div class="empty-msg">最近没有任何订单，家里好像缺了点什么！<br><a href="/index/item_category.html">要不瞧瞧去？</a></div>
									</td>
								</tr>
							</table>
							<!-- 分页 -->
						</div>
						<script>
							$('.delete').click(function(){
								var href=$(this).attr('href');
								layer.confirm('你确定要删除吗',{},function(){
									window.location.href=href;
								},function(){
									layer.msg('已取消');
								})
								return false;
							})
						</script>
						<script>
							$('.order-empty').each(function(){
								if($(this).prev().hasClass('order-item')){
									$(this).remove();
								}
							})
						</script>
					</div>
				</div>
			</div>
		
		</div>
	</div>
@endsection